import React, { Suspense } from 'react';
import ReactDOM from 'react-dom';
import App from './App';
import * as serviceWorker from './serviceWorker';
import zhCN from 'antd/es/locale/zh_CN';
import { ConfigProvider } from "antd";
import moment from 'moment';
import 'moment/locale/zh-cn';
import Loading from "@components/Loading";
import {Simulate} from "react-dom/test-utils";


moment.locale('zh-cn');

const loading = document.getElementById("init-loading");
loading?.remove();

ReactDOM.render(
  // <React.StrictMode>
  <Suspense fallback={<Loading/>}>
    <ConfigProvider locale={zhCN}>
      <App />
    </ConfigProvider>
  </Suspense>,
  // </React.StrictMode>,
  document.getElementById('root')
);

/*window.addEventListener('error', function (e) {
    let target: any = e.target,
        tagName = target?.tagName,
        times = Number(target?.dataset?.times) || 0, // 以失败的次数，默认为0
        allTimes = 3; // 总失败次数，此时设定为3
    if (tagName.toUpperCase() === 'IMG') {
        if (times >= allTimes) {
            target.src = '';
        } else {
            target.dataset.times = times + 1;
            target.src = '/src/assets/img/avatar5.jpeg';
        }
    }
}, true)*/


serviceWorker.unregister();
